﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/CompanyCenter.Master"
    Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%:SiteResource.Title() %>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
    <link rel="Stylesheet" type="text/css" href="/Content/css/popupbox.css" />
    <script type="text/javascript" src="/Scripts/jquery-1.4.1.min.js"></script>
    <script type="text/javascript" src="/Scripts/library.js" charset="GB2312"></script>
    <script type="text/javascript" src="/Scripts/plug.js" charset="GB2312"></script>
    <script type="text/javascript">
        var library = new plug.PopFrame();
        function OpenFrame(sender) {
            $(sender).parent().parent().siblings('div').toggle();
            if ($(sender).text() == '展开') {
                $(sender).text('收起');
            }
            else {
                $(sender).text('展开');
            }
        }
        function TriggerClick(sender) {
            $(sender).parent().siblings('div').children('a').eq(0).trigger('click');
        }
        function Control(sender, id, type) {
            if (type && type == 1) { //如果是未审核的。允许重新编辑
                $(sender).parent()
                .append($('<a href="/CompanyCenter/EditRecruiting/' + id + '" class="ctr">重新编辑</a>'))
                .append($('<span>&nbsp;</span>'));
            }
            $(sender).parent()
                .append($('<a href="javascript:;" class="ctr" onclick="DeleteThis(this,' + id + ')">删除</a>'))
                .append($('<span>&nbsp;</span>'))
                .append($('<a href="javascript:;" class="ctr" onclick="Cancel(this,'+id+','+type+')">返回</a>'));
            $(sender).remove();
        }
        function Cancel(sender,id,type) {
            $(sender).parent().children('span').each(function () {
                $(this).remove();
            });
            $(sender).parent().append($('<a href="javascript:;" onclick="Control(this,' + id + ',' + type + ')">管理</a>'));
            $(sender).parent().children('.ctr').each(function () {
                $(this).remove();
            });
        }
        function TabSheet(sender, idx) {
            if ($(sender).attr('class') == 'current1') {
                $('.listbox').each(function () {
                    if ($(this).attr('id') == 'sheet' + idx) {
                        $(this).show();
                    }
                    else {
                        $(this).hide();
                    }
                });
                $(sender).attr('class', 'current-red');
                $(sender).parent().siblings('div').children('a').attr('class', 'current1');
            }
        }
        function DeleteThis(sender,id) {
            if (confirm('您确定要结束并删除此招募信息吗？')) {
                $.ajax({
                    url: '/CompanyCenter/DeleteRecruit',
                    data: { id: id },
                    type: 'post',
                    success: function (result) {
                        if (result == '1') {
                            $(sender).parent().parent().parent().remove();
                        }
                    }
                });
            }
        }
        function topthis(id) {
            library.OpenFrame('TopActive', 'btncolsetemp', null);
            $('input[name="domakeid"]').val(id);
        }
        function colosefarme() {
//            var o = $('#backmsg');
//            if (o != null) { o.remove(); }
            $('#btncolsetemp').trigger('click');
            return false;
        }
        function domake(sender) {
            var id = $('input[name="domakeid"]').val();
            $.ajax({
                url: '/companycenter/maketop',
                data: { id: id },
                cache: true,
                success: function (res) {
                    colosefarme();
                    new plug.MessageBox().Show('<div style="padding-top:10px;padding-bottom:10px;width:75px;margin-left:auto;margin-right:auto;font-size:15px;color:green;">操作成功！</div>');
                    //                    window.setTimeout(function () {
                    //                        var o = $('#backmsg');
                    //                        if (o != null) { o.remove(); }
                    //                        colosefarme();
                    //                    }, 3000);
                    //                    $(sender).parent().parent().append(
                    //                    $('<div id="backmsg" style="color:green;width:160px;margin-left:auto;margin-right:auto;">操作成功，3秒后自动返回</div>'));
                }
            });
            return false;
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder" runat="server">
    <div class="usercenter-main">
        <div class="usercenter-main-topbg">
        </div>
        <div id="TopActive" class="popbox-box" style="width: 400px; height: auto">
            <input type="hidden" name="domakeid" />
            <div class="popbox-title">
                <div class="popbox-right">
                    <a href="javascript:;" id="btncolsetemp">
                        <img src="/Content/Images/closelabel.gif" /></a></div>
            </div>
            <div class="popbox-content">
                <div style="padding:5px 20px;border-bottom:1px solid #ccc">
                    <font style="color:#A10000">
                        顶：
                    </font>通过"顶"操作，可将兼职信息更新时间设置为当前时间，以使该兼职排序靠前，获得更多关注。
                    <br />
                    <font style="color:#A10000">
                        注：
                    </font>您发布兼职一天以后使用此功能有效
                </div>
                <div style="padding-top:10px;width:165px;margin-left:auto;margin-right:auto;">
                    <input type="image" onclick="domake(this)" src="/content/images/submit.png" />
                    <input type="image" onclick="colosefarme()" src="/content/images/usercenter-return.png" />
                </div>
            </div>
        </div>
        <div class="usercenter-main-content">
            <div class="usercenter-main-content-title">
                <div class="usercenter-main-content-title-left">
                    兼职管理</div>
            </div>
            <div class="usercenter-notes">
                您可以在这里对你所发布的兼职进行查看、管理
                </div>
            <div class="usercenter-tab">
                <div class="usercenter-tab-item">
                    <a href="javascript:;" onclick="TabSheet(this,1)" class="current-red">进行中</a></div>
                <div class="usercenter-tab-item">
                    <a href="javascript:;" onclick="TabSheet(this,3)" class="current1">待审核</a></div>
            </div>
            <div class="listbox" id="sheet1">
            <%var noexpies = ViewData["Recruiting"] as ItemListBox<RecruitSheetModel>;
              if (noexpies != null && noexpies.Data.Any())
              {
                  foreach (var item in noexpies.Data)
                  { %>
                <div class="listbox-item">
                    <div class="listbox-item-title">
                        <div class="left">
                            <a href="javascript:;" onclick="TriggerClick(this)">[<%:item.PublishDate.ToShortDateString() %>]<%:item.Caption%></a>&nbsp;</div>
                        <div class="right">
                            <a href="javascript:;" onclick="topthis(<%:item.Id %>)">顶！</a>
                            <%--<a href="javascript:;" onclick="OpenFrame(this)">展开</a>--%>
                            <a target="_blank" href="/home/jobdetail_<%:item.Id %>">查看详情</a> <a href="javascript:;" onclick="Control(this,<%:item.Id %>)">管理</a></div>
                    </div>
                    <div class="listbox-item-c">
                        <div class="listbox-item-positions">
                            <%foreach (var position in item.Positions)
                              { %>
                            <div class="positions-item">
                                <div class="left">
                                    <a target="_blank" href="/CompanyCenter/PositionDetail/<%:position.Id %>">-<%:position.PositionName%></a></div>
                                <div class="right">
                                    已收到<%:position.ItemCountOfRequestSheet%>份简历&nbsp;&nbsp;&nbsp;<a target="_blank" href="/CompanyCenter/PositionDetail/<%:position.Id %>">查看详情</a></div>
                            </div>
                            <%} %>
                        </div>
                    </div>
                    <div class="listbox-item-bottomline">
                    </div>
                </div>
                <%} %>
            <%}
              else { 
              %>
              <div class="listbox-item">
                您没有审核通过的兼职信息。立即<a target="_blank" href="/CompanyCenter/Recruiting">发布兼职</a>
                <div class="listbox-item-bottomline"></div>
              </div>
            <%} %>
                <div class="listbox-bottom">
                    <div class="listbox-bottom-item">
                        <!--下一页-->
                        <%if (noexpies.NextPage <= 0 || noexpies.NextPage >= noexpies.TotlePage-1)
                          { %>
                          <a class="next1" href="javascript:;"></a>
                        <%}
                          else
                          { %>
                        <a class="next" href="?page=<%:noexpies.NextPage %>"></a>
                        <%} %>
                    </div>
                    <div class="listbox-bottom-item">
                        <!--上一页-->
                        <%if (noexpies.CurrentPage != 1 && noexpies.PrePage <= 0)
                          { %>
                          <a class="prev1" href="javascript:;"></a>
                        <%}
                          else
                          { %>
                        <a class="prev" href="?page=<%:noexpies.PrePage %>"></a>
                        <%} %>
                    </div>
                    <div class="listbox-bottom-item">
                        <%:noexpies.CurrentPage+1 %>/<%:noexpies.TotlePage %>&nbsp;&nbsp;&nbsp;
                    </div>
                </div>
            </div>
            <div class="listbox" id="sheet3" style="display:none;">
                 <%var novalid = ViewData["NoVerify"] as ItemListBox<RecruitSheetModel>;
                   if (novalid != null && novalid.Data.Any())
                   {
                       foreach (var item in novalid.Data)
                       { %>
                <div class="listbox-item">
                    <div class="listbox-item-title">
                        <div class="left">
                            <a href="javascript:;" onclick="TriggerClick(this)"><%:item.Caption%></a><b>&nbsp;[待审核]</b>&nbsp;</div>
                        <div class="right">
                            <a href="javascript:;" onclick="OpenFrame(this)">展开</a>
                            <a target="_blank" href="/home/jobdetail_<%:item.Id %>">查看详情</a> <a href="javascript:;" onclick="Control(this,<%:item.Id %>,1)">管理</a></div>
                    </div>
                    <div class="listbox-item-c">
                        <div class="listbox-item-positions">
                            <%foreach (var position in item.Positions)
                              { %>
                            <div class="positions-item">
                                <div class="left">
                                    <a target="_blank" href="/CompanyCenter/PositionDetail/<%:position.Id %>">-<%:position.PositionName%></a></div>
                                <div class="right">
                                    请等待系统审核</div>
                            </div>
                            <%} %>
                        </div>
                    </div>
                    <div class="listbox-item-bottomline">
                    </div>
                </div>
                <%} %>
            <%}
                   else
                   { %>
              <div class="listbox-item">
                您没有待审核的兼职。
                <div class="listbox-item-bottomline"></div>
              </div>
              <%} %>
                <div class="listbox-bottom">
                    <div class="listbox-bottom-item">
                        <!--下一页-->
                        <%if (novalid.NextPage <= 0 || novalid.NextPage >= novalid.TotlePage-1)
                          { %>
                          <a class="next1" href="javascript:;"></a>
                        <%}
                          else
                          { %>
                        <a class="next" href="?page=<%:novalid.NextPage %>"></a>
                        <%} %>
                    </div>
                    <div class="listbox-bottom-item">
                        <!--上一页-->
                        <%if (noexpies.CurrentPage != 1 && novalid.PrePage <= 0)
                          { %>
                          <a class="prev1" href="javascript:;"></a>
                        <%}
                          else
                          { %>
                        <a class="prev" href="?page=<%:novalid.PrePage %>"></a>
                        <%} %>
                    </div>
                    <div class="listbox-bottom-item">
                        <%:novalid.CurrentPage + 1%>/<%:novalid.TotlePage%>&nbsp;&nbsp;&nbsp;
                    </div>
                </div>
            </div>
        </div>
        <div class="usercenter-main-bottombg">
        </div>
    </div>
</asp:Content>
